<?php
// ========================== 文件说明 ==========================//
// 本文件说明：后台首页
// ==============================================================//

if(!defined('IN_ROOT') || !isset($php_self) || !preg_match("/[\/\\\\]index\.php$/", $php_self)) {
	exit('Access Denied');
}

function getphpcfg($varname) {
	switch($result = get_cfg_var($varname)) {
		case 0:
			return '关闭';
			break;
		case 1:
			return '打开';
			break;
		default:
			return $result;
			break;
	}
}

function getfun($funName) {
	return (function_exists($funName)) ? '支持' : '不支持';
}

$globals  = getphpcfg('register_globals');
$safemode = getphpcfg('safe_mode');


//查询数据信息
$hiddensiteol = $db->num($db->query("SELECT siteid FROM {$tablepre}xna_site WHERE state='0'"));
$hiddenarttatol = $db->num($db->query("SELECT feedid FROM {$tablepre}xna_feed WHERE state='0'"));
$hiddencomtatol = $db->num($db->query("SELECT commid FROM {$tablepre}xna_comment WHERE state='0'"));

$server['datetime'] = sadate('Y-m-d H:i:s');
$server['software'] = $_SERVER['SERVER_SOFTWARE'];


$onlines = $waponlines = array();
$query = $db->query("SELECT s.uid,s.ipaddress,s.lastactivity,s.groupid,u.username FROM {$tablepre}xna_sessions s LEFT JOIN {$tablepre}xna_users u ON (s.uid=u.uid) ORDER BY s.lastactivity");
while($online = $db->row($query)) {
	$online['lastactivity'] = sadate('Y-m-d H:i:s', $online['lastactivity']);
	if ($online['groupid'] == 1 || $online['groupid'] == 2) {
		$onlines[] = $online;
	} else {
		$waponlines[] = $online;
	}
}
unset($online);
$db->row($query);

$now_version = rawurlencode($IXNA_VERSION);
$now_release = rawurlencode($IXNA_RELEASE);
$now_hostname = rawurlencode($_SERVER['HTTP_HOST']);

$navlink_L = ' &raquo; 后台首页';
cpheader();
include template("main", _ROOT . "/template/admin/");
?>